//
//  MainViewController.m
//  宜居HD
//
//  Created by 张金国 on 16/4/26.
//  Copyright © 2016年 张金国. All rights reserved.
//

#import "MasterViewController.h"
#import "UIColor+RandomColor.h"
#import "Masonry.h"
#import "Macro.h"
//#import "Dock.h"


@interface MasterViewController ()

@property (nonatomic ,strong)NSMutableArray *images;
@property (nonatomic ,strong)NSMutableArray *cancleImages;
@property (nonatomic ,strong)Dock    *dock;



@end

@implementation MasterViewController

#pragma mark - LifeCircle
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupConstraints];
    
}



#pragma mark - Private

- (void)setupConstraints {
    [self.dock mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
}

#pragma mark - Getter
- (Dock *)dock {
    if (!_dock) {
        _dock = [[Dock alloc]initWithimages:self.images cancelImages:self.cancleImages andClickBlock:^(DockButonType dockButonType) {
            DDLogInfo(@"dockButonType------%ld",dockButonType);
            if (self.block != nil) {
                
                NSString *controllerName;
                
                switch (dockButonType) {
                    case SalerInfomationButton:{
                         controllerName = @"PersonCenterViewController";
                    }break;
                    case UserMangermentButton:{
                       controllerName = @"UserManageViewController";
                    }break;
                    case BusinessTaIkButton:{
                        controllerName = @"DiscussViewController";
                    }break;
                    case HouseLayoutButton:{
                       controllerName = @"HouseTypeInfoViewController";
                    }break;
                    case ChatButon:{
                        controllerName = @"ChatOnlineViewController";
                    }break;
                    case ModelControlButton:{
                        controllerName = @"SandboxViewController";
                    }break;
                    case SettingButon:{
                        controllerName = @"SettingViewController";
                    }break;
                    default:
                        break;
                }
                self.block(controllerName);
            }
        }];
        [self.view addSubview:_dock];
    }
    return _dock;
}

- (NSMutableArray *)cancleImages {
    if (!_cancleImages) {
        NSArray *arry = @[
                          [UIImage imageNamed:@"HeadImage"],
                          [UIImage imageNamed:@"usermanagement_Do"],
                          [UIImage imageNamed:@"BusinessTaIk_Do"],
                          [UIImage imageNamed:@"Project_Do"],
                          [UIImage imageNamed:@"Chat_Do"],
                          [UIImage imageNamed:@"shaPan_Do"],
                          [UIImage imageNamed:@"Settings_Do"]
                          ];
        _cancleImages = [NSMutableArray arrayWithArray:arry];

    }
    return _cancleImages ;

}
- (NSMutableArray *)images {
    if (!_images) {
        NSArray *arry = @[
                          [UIImage imageNamed:@"HeadImage"],
                          [UIImage imageNamed:@"usermanagement"],
                          [UIImage imageNamed:@"BusinessTaIk"],
                          [UIImage imageNamed:@"Project"],
                          [UIImage imageNamed:@"Chat"],
                          [UIImage imageNamed:@"shaPan"],
                          [UIImage imageNamed:@"Settings"]
                          ];
        _images = [NSMutableArray arrayWithArray:arry];
    }
    return _images;
}

@end
